import requests

from commons.entity.enum.base_url_enum import BaseUrlEnum
from commons.entity.po.reimbursement import Reimbursement


class ReimbursementClient:
    def __init__(self):
        pass

    def get_reimbursements_by_id_list(self, id_list):
        url = f"{BaseUrlEnum.TRAVEL_SERVICE_URL.url}/reimbursement/getReimbursementsByIdList"
        headers = {"Content-Type": "application/json"}
        response = requests.post(
            url, json={"idList": id_list}, headers=headers)

        if response.status_code == 200:
            reimbursement_data = response.json()
            reimbursements = [Reimbursement(**data) for data in reimbursement_data]
            return reimbursements
        else:
            response.raise_for_status()
